package com.atguigu.srb.core.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
@ConfigurationProperties(prefix = "wx.login")
public class WxLoginProperties implements InitializingBean {

    private String apiUrl;
    private String appid;
    private String secret;
    private String redirectUri;
    private String callbackUrl;
    private String userInfoUrl;
    private String redirectUrl;

    public static String API_URL;
    public static String APP_ID;
    public static String SECRET;
    public static String REDIRECT_URI;
    public static String CALLBACK_URL;
    public static String USERINFO_URL;
    public static String REDIRECT_URL;



    @Override
    public void afterPropertiesSet() throws Exception {
        API_URL = this.apiUrl;
        APP_ID = this.appid;
        SECRET = this.secret;
        REDIRECT_URI = this.redirectUri;
        CALLBACK_URL = this.callbackUrl;
        USERINFO_URL = this.userInfoUrl;
        REDIRECT_URL = this.redirectUrl;
    }
}
